Random, NewSeed, A_MSec + 0


RandomPos(a, b)
{
  if (a > b)                        
  { 
    b := a + b
    a := b - a       
    b := b - a
  }
  result = 0
  Random, result, a, b
  return result 
}
MouseClickRandom(x, y, delta = 0)
{
  Random, deltaXY, -delta, delta
  MouseClick, left, x + deltaXY, y + deltaXY
  
  xx := x + deltaXY
  yy := y + delayXY
}

MouseClickRandomPath(xend, yend, delta = 0)
{
  MouseGetPos, xpos, ypos
  Random, steps, 1, 5
  
  Loop %steps%
  {
    if (xpos = xend and ypos = yend)
      break
    xpos := RandomPos(xpos, xend)
    ypos := RandomPos(ypos, yend)
    MouseMove, xpos, ypos
  }
  MouseClickRandom(xend, yend, delta)
}

MouseClickRel(x, y)
{
  MouseGetPos, xpos, ypos
  
  newx = %x%  
  if (SubStr(x, 1, 1) = "+")
  {
    newx := xpos + SubStr(x, 2)
  }
    
  newy = %y%
  if (SubStr(y, 1, 1) = "+")
  {
    newy := ypos + SubStr(y, 2)
  }
  ;Info(newx . "," . newy)  
  MouseClick, left, newx, newy
}


MouseMoveRandomPath(xend, yend)
{
  MouseGetPos, xpos, ypos
  Random, steps, 1, 5
  
  Loop %steps%
  {
    if (xpos = xend and ypos = yend)
      break
    xpos := RandomPos(xpos, xend)
    ypos := RandomPos(ypos, yend)
    MouseMove, xpos, ypos
  }
  if (xpos <> xend or yos <> yend)
  {
    MouseMove, xend, yend
  }    
}